home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20010306-20010921 / 000042_news@columbia.edu _Wed Mar 28 17:52:01 2001.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id RAA01951
  4.     for <kermit.misc@cpunix.cc.columbia.edu>; Wed, 28 Mar 2001 17:52:00 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id RAA19820
  7.     for kermit.misc@watsun.cc.columbia.edu; Wed, 28 Mar 2001 17:25:08 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@columbia.edu (Frank da Cruz)
  10. Subject: Re: need passive mode ftp command line client
  11. Date: 28 Mar 2001 22:25:07 GMT
  12. Organization: Columbia University
  13. Message-ID: <99toc3$jba$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16. In article <9905ku$b4u$1@newsmaster.cc.columbia.edu>,
  17. Frank da Cruz <fdc@watsun.cc.columbia.edu> wrote:
  18. : In article <slrn9b5n4p.mt.grante@tuxtop.visi.com>,
  19. : Grant Edwards <grante@visi.com> wrote:
  20. : : On Fri, 16 Mar 2001 16:30:58 -0800, Anthony Ewell <aewell@gbis.com> wrote:
  21. : : >I need to write a script that will do a directory
  22. : : >of an ftp site.  Then,  depending on what I find in the
  23. : : >directory, do a download in passive mode.   (Passive
  24. : : >mode is required to get by my firewall.)
  25. :
  26. A while back I answered this, recommending the new Kermit FTP
  27. client, but it involved capturing the server's directory listing
  28. and parsing it, which is crude, and then I said:
  29.  
  30. : C-Kermit 7.1 is currently in prerelease testing, so this is a good time
  31. : to try it and send in any comments or suggestions about the scriptable
  32. : FTP client.  In fact, your problem suggests one improvement already, which
  33. : is to make the NLST result available to the program directly, so you don't
  34. : have to parse arbitrary directory-listing formats.
  35. Silly me, I had already put this feature in without noticing that I did it.
  36. The command is:
  37.  
  38.   FTP MGET /NAMELIST:filename remote-filespec [ remote-filespec ... ]
  39.  
  40. This puts the list of names, one name per line, into the given filename.
  41. For example:
  42.  
  43.   ftp cd somedirectory
  44.   ftp mget /namelist:list-o-files *
  45.  
  46. If this succeeds, then you can use:
  47.  
  48.   fopen /read \%c list-o-files
  49.   if fail ...
  50.   while not \f_eof(\%c) {
  51.       fread \%c filename
  52.       if fail ...
  53.       echo The next file is "\m(filename)"
  54.   }
  55.   echo Done.
  56.  
  57. Replace the ECHO statement with whatever you want to do with each file.
  58.  
  59. For more information on the new ftp client, visit:
  60.  
  61.   http://www.columbia.edu/kermit/ftpclient.html
  62.  
  63. - Frank